package com.wen.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wen.pojo.Consumer;
import com.wen.pojo.dto.ConsumerDto;
import com.wen.pojo.dto.SupplierDto;
import org.apache.ibatis.annotations.Select;

public interface ConsumerMapper extends BaseMapper<Consumer> {

    @Select("select c.*,s.company_name as companyName,s.address FROM `consumer` c INNER JOIN `supplier` s WHERE c.consumer_id=s.consumer_id AND c.consumer_id=${consumerId} AND c.`supplier_tag`='s001-4'")
    ConsumerDto ConById(Long consumerId);

    @Select("SELECT s.*,c.`supplier_tag` FROM supplier s INNER JOIN consumer c WHERE s.`consumer_id`=c.`consumer_id` AND s.`consumer_id`=${consumerId} AND c.`supplier_tag`='s001-4'")
    SupplierDto views(Long consumerId);
}
